package com.lsc.record.core.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.mybatisflex.core.row.Row;

public class RowConvertUtil {
	public static Row toJSONObjectLowerKey(Map<String,Object> map) {
		Row row = new Row();
		for (Map.Entry<String,Object> entry : map.entrySet()) {
			String key = entry.getKey().toLowerCase();
			Object val = entry.getValue();
			row.put(key, val);			
		}
		return row;
	}
	
	public static Row toRowLowerKey(Row current) {
		Row row = new Row();
		row.putAll(current.toCamelKeysMap());
		Map<String,Object> map= row.toUnderlineKeysMap();
		row = new Row();
		row.putAll(map);
		return row;
	}
	
	public static List<Row> toRowListLowerKey(List<Row> current) {
		List<Row> result = new ArrayList<>();
		for (Row row : current) {
			result.add(toRowLowerKey(row));
		}
		return result;
	}
}
